package com.cskaoyan.javase.oop2.encapsulate._1extends._8hidden._2exercise;

/**
 * 练习题
 * @since 15:52
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo {
    public static void main(String[] args) {
        Cat c = new Cat(8);
        System.out.println(c.age);

        Cat c2 = new Cat(10, 12);
        System.out.println(c2.age);

        Animal a = new Cat(8);
        System.out.println(a.age);

        Animal a2 = new Cat(10, 12);
        System.out.println(a2.age);

        System.out.println(new Cat(8).age);
    }
}

class Animal {
    int age = 6;

    public Animal(int age) {
        this.age = age;
    }
}

class Cat extends Animal {
    int age = 7;

    public Cat(int age) {
        super(age);
    }

    public Cat(int fatherAge, int sonAge) {
        super(fatherAge);
        this.age = sonAge;
    }
}